home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / cclib / include / iolib.h < prev    next >
C/C++ Source or Header  |  1995-11-16  |  3KB  |  119 lines

  1. #ifndef IOLIB_H
  2. #define IOLIB_H 1
  3.  
  4. /*-------------------------------------------------------------------------+
  5.  |                                       |
  6.  | Name:    iolib.h                               |
  7.  | Purpose: the structure that gets attached to your task's user data      |
  8.  |                                       |
  9.  | Author:  RWA                    Date: 8/89           |
  10.  +-------------------------------------------------------------------------*/
  11.  
  12. #ifndef EXEC_MEMORY_H
  13. #include <exec/memory.h>
  14. #endif
  15.  
  16. #ifndef LIBRARIES_DOS_H
  17. #include <libraries/dos.h>
  18. #endif
  19.  
  20. #ifndef LIBRARIES_DOSEXTENS_H
  21. #include <libraries/dosextens.h>
  22. #endif
  23.  
  24. #ifndef EXEC_TASKS_H
  25. #include <exec/tasks.h>
  26. #endif
  27.  
  28. #ifndef WORKBENCH_STARTUP_H
  29. #include <workbench/startup.h>
  30. #endif
  31.  
  32. #ifndef STDLIST_H
  33. #include "stdlist.h"
  34. #endif
  35.  
  36. #ifndef HEAPMEM_H
  37. #include "heapmem.h"
  38. #endif
  39.  
  40. #ifndef STDIO_H
  41. #include "stdio.h"
  42. #endif
  43.  
  44. #ifndef TIME_H
  45. #include "time.h"
  46. #endif
  47.  
  48. typedef void (*ABORT_FUNC)(long);
  49.  
  50.  
  51.  
  52. typedef struct    /* task_UserData */
  53. {
  54. void *old_ud;             /* points to the old user data */
  55. struct Task *parent;         /* points to your task */
  56. _list RAM;             /* list of allocated memory, see MemBlk */
  57. HEADER base, *allocp;         /* used for heap managment */
  58. long *blocksize;         /* points to minimum heap block size */
  59. LastFree lastfree;         /* the last free'd block of heap memory */
  60. _list OpenFiles;         /* a list of FileDesc, see below */
  61. _list StreamFiles;         /* a list of FILE, see stdio.h */
  62. FILE **stdout, **stdin, **stderr;/* pointers to standard IO stream files */
  63. void *scnfp;             /* used internally by fprintf etc. */
  64. long *errno;             /* pointer to global errno in app. */
  65. ABORT_FUNC abort_func;         /* abort function for ^C etc. (_exit) */
  66. void *wbmsg;             /* pointer to workbench startup message */
  67. short _argc, _arg_len;         /* for CLI arguments */
  68. char **_argv, *_arg_lin;     /* for CLI arguments */
  69. char *scanpoint;         /* used internally by strtok */
  70. char *tempname;          /* used internally by tmpnam */
  71. short scnlast;             /* used internally by gchar etc. */
  72. struct tm tm;             /* used by time routines */
  73. clock_t start;             /* ticks at program start */
  74. char buffer[80];         /* buffer for general use */
  75. void *scdir_mem;         /* memory used by scdir */
  76. void *getenv_mem;         /* used internally by getenv */
  77. struct MsgPort *exeport;     /* message port for exe'd processes */
  78. _list Children;          /* list of children (struct Child) */
  79. } task_UserData;
  80.  
  81. /* This is a what a "file handle" points to, I am cheating by
  82.  * putting pointers to this in a long integer.
  83.  */
  84. typedef struct
  85. {
  86. BPTR fh;
  87. short mode;
  88. } FileDesc;
  89.  
  90. /* This is what the RAM list consists of. It is a linked list of RAM
  91.  * that has been allocated from Amiga EXEC with the AllocMem function.
  92.  * The size field is the size in bytes that was allocated, and is followed
  93.  * by the allocated block.
  94.  */
  95. typedef struct
  96. {
  97. _node n;
  98. long size;
  99. } MemBlk;
  100.  
  101. /* This is what the Chidren _list consists of. It is a list of the child
  102.  * processes that were spawned asynchronously, and that need to have their
  103.  * code unloaded before the parent can terminate itself.
  104.  */
  105. typedef struct
  106. {
  107. struct WBStartup startup;     /* startup message sent to the child */
  108. struct WBArg arg;          /* startup message argument */
  109. struct Process *pid;          /* pointer to the child process */
  110. } Child;
  111.  
  112. #ifndef REGS
  113. #define REGS register
  114. #endif
  115.  
  116. #endif
  117.  
  118.  
  119.